package com.itheima.exer.homework.hw1009;

import java.io.*;
import java.util.Arrays;

public class NumberTest2 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(new File("exercises\\c.txt")));
        String s = br.readLine();
        String[] split = s.split(",");
        int[] strArray = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            strArray[i] = Integer.parseInt(split[i]);
        }
        Arrays.sort(strArray);
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < strArray.length; i++) {
            if (i == strArray.length-1){
                sb.append(strArray[i]);
            }else {
                sb.append(strArray[i]+",");
            }
        }
        String s1 = sb.toString();
        BufferedWriter bw = new BufferedWriter(new FileWriter(new File("exercises\\c.txt")));
        bw.newLine();
        bw.write(s1);
        br.close();
        bw.close();
    }
}
